/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2022-01-16 16:24:00
 * @LastEditors: GGB
 * @LastEditTime: 2022-01-16 18:07:35
 */
import React, { useState,useEffect } from 'react'
const LikeButton = () => {
    const [like, setLike] = useState(0)
    const [on,setOn] =useState(true)
    // const [obj, setObj] = useState({like:0,on:true})
    // 添加副作用
    useEffect(() => { 
        document.title=`点击了${like}次`
    })
    return (
        <>
                {on&&<button  onClick={() => {setLike(like+1)}}>
                {like} 赞
                </button>}
            <button onClick={() => { setOn(!on)}}>
                {on?'On':'Off'}
            </button>
        </>
        
    )
}

export default LikeButton;